
use tables/estimates_bs_ci, clear 
local s 8

** special for icli
format  lb_pop ub_pop lower_bound4 upper_bound4 %3.2f
# delimit ;
twoway
	(rarea lb_pop ub_pop  week , color(gs8%25) )		
	(rarea lower_bound4 upper_bound4 week, color(gs5%75) )	
	,
	
	xlabel(`=mdy(3,13,2020)' "3/13" `=mdy(6,13,2020)' "6/13"  
		`=mdy(9,13,2020)' "9/13" `=mdy(12,13,2020)' "12/13", labsize(medium) )
	ylabel(0 .2 .4 .6, labsize(medium))
	legend(off)
	xtitle("")
	ytitle("")
	graphregion(color(white) margin(r+`s'))
	text(.18 22260 "All", color(gs10) place(e)  size(medsmall))
	text(.38 22260 "In" "hospital", color(gs5) place(e) size(medsmall) justification(left))
	title("ICLI Hospitalizations",  ring(0) pos(11) size(medium) )
	text(0.54 `=mdy(3,13,2020)' "Representativeness rejected",	place(e)  size(medsmall))
	name(icli, replace)
	
;
# delimit cr
	
** clear/non-icli same formatting 

foreach g in  non clear {
	foreach suff in m i {
				
		if "`suff'" == "m" local subtitle "Hospital monotonicity"
		if "`suff'" == "i" local subtitle "Hospital independence"
			
			
		if "`g'" == "non" {
			local title "Non-ICLI Hospitalizations"
			local name "Non-ICLI"
		}
		if "`g'" == "clear" {
			local title "Clear Cause Hospitalizations"
			local name "Clear cause"
		}
		
		# delimit ;
		twoway
		
			(rarea lb_pop ub_pop  week , color(gs8%25) )		
		
			(rarea lb_`g'_`suff' ub_`g'_`suff' week, color(gs5%75) )		
			(line p025_`g'_`suff'  week , color(black) lpattern(dash))
			(line p975_`g'_`suff'  week , color(black) lpattern(dash))			
			,
			
			xlabel(`=mdy(3,13,2020)' "3/13" `=mdy(6,13,2020)' "6/13"  
				`=mdy(9,13,2020)' "9/13" `=mdy(12,13,2020)' "12/13", labsize(medium) )
			ylabel(0(.08).24, labsize(medium))
			xsize(4) ysize(3)
			legend(off)
			xtitle("")
			ytitle("")
			graphregion(color(white) margin(r+`s'))
			title("`title'" , ring(0) size(medium) pos(11) )
			
			text(0.22 `=mdy(3,13,2020)' "`subtitle'", place(e)  size(medsmall))			
			text(.15 22260 "All", color(gs10) place(e) size(medsmall))
			text(.04 22260 "In" "hospital", color(gs4) place(e) size(medsmall) justification(left))
			
			name(`g'_`suff', replace)
			
		;
		# delimit cr
	}
}


graph combine icli non_m non_i clear_m clear_i, cols(2) hole(2) ///
	graphregion(color(white)) xsize(8) ysize(9) 
	
graph export figures/bounds_all_groups_wtd_ci.pdf, replace 
